package com.baoai.dto;

import org.apache.lucene.document.TextField;
import org.json.JSONObject;

import java.util.Arrays;

/**
 * Created by xiaren on 2017/3/4.
 */
public class SearchIndexDto {

    public static final String ID = "id";

    public static final String TITLE = "title";

    public static final String CONTENT = "content";

    public static final String TYPE = "type";

    public static final String SRC_ARRAYS = "srcArrays";

    public static final String POWER = "power";

    public static final String LABEL_ = "label_";

    public static final String LABEL_0 = "label_0";

    public static final String LABEL_1 = "label_1";

    public static final String LABEL_2 = "label_2";

    public static final String NUMBER = "number";

    public static final String TIME = "time";

    public static final String TOPIC_ID = "topicId";

    public static final String PRESET_PRICE = "presentPrice";

    public static final String OLD_PRICE = "oldPrice";

    public static final String TITLE_NAME = "titleName";

    public static final String ADDRESS = "address";

    public static final String AUTHOR = "author";

    // ID
    private String id;
    // 标题【视频、问答、课程、文章、专家(专家里面就是指专家的名字)】
    private String title;
    // 详情【问答(答案)、专家(简介)】
    private String content;
    // 类型【1：视频、2问答、3课程、4文章、5专家】
    private String type;
    // 缩略图路径数组
    private String[] srcArrays;
    // 权重【课程已学过数、专家(好评度)、问答(听过的认识)、文章已看过人数】
    private Integer power = 0;
    // 标签【视频、文章(话题名称)、专家】
    private String[] labelArrays;
    // 视频评论数、问答点赞数、课程几颗星、专家学员人数
    private Integer number;
    // 视频时间 ，单位秒
    private Integer time;
    // 类型ID(问答的类型)
    private Integer topicId;
    // 当前价格【课程 ,单位 分】
    private Integer presentPrice;
    // 原价【课程 , 单位 分】
    private Integer oldPrice;
    // 作者【文章里面】
    private String author;
    // 职业称呼【专家：eg 保爱资深咨询师】
    private String titleName;
    // 地址【专家地址】
    private String address;


    public SearchIndexDto() {
    }

    private SearchIndexDto(String id, String title, String type, String[] srcArrays) {
        this.id = id;
        this.title = title;
        this.type = type;
        this.srcArrays = srcArrays;
    }

    /**
     * 用于创建视频类型DTO
     *
     * @param id          视频ID
     * @param title       视频标题
     * @param content     问答结果
     * @param type        类型：1
     * @param srcArrays   图片路径
     * @param labelArrays 标签
     * @param number
     * @param time        时长 秒
     */
    public SearchIndexDto(String id, String title, String content, String type, String[] srcArrays, String[] labelArrays, Integer number, Integer time) {
        this(id, title, type, srcArrays);
        this.content = content;
        this.labelArrays = labelArrays;
        this.number = number;
        this.time = time;
    }

    /**
     * 用于创建问答类型DTO
     *
     * @param id
     * @param title
     * @param type      类型2
     * @param srcArrays 图片路径
     * @param power     听过的人数
     * @param number    点赞数
     * @param topicId   话题ID
     */
    public SearchIndexDto(String id, String title, String type, String[] srcArrays, Integer power, Integer number, Integer topicId) {
        this.id = id;
        this.title = title;
        this.type = type;
        this.srcArrays = srcArrays;
        this.power = power;
        this.number = number;
        this.topicId = topicId;
    }


    /**
     * 用于创建课程类型DTO
     *
     * @param id
     * @param title
     * @param type
     * @param srcArrays
     * @param power
     * @param number
     * @param presentPrice
     * @param oldPrice
     */
    public SearchIndexDto(String id, String title, String type, String[] srcArrays, Integer power, Integer number, Integer presentPrice, Integer oldPrice) {
        this.id = id;
        this.title = title;
        this.type = type;
        this.srcArrays = srcArrays;
        this.power = power;
        this.number = number;
        this.presentPrice = presentPrice;
        this.oldPrice = oldPrice;
    }

    /**
     * 用于创建文章类型DTO
     *
     * @param id
     * @param title
     * @param type
     * @param srcArrays
     * @param power
     * @param labelArrays
     * @param author
     */
    public SearchIndexDto(String id, String title, String type, String[] srcArrays, Integer power, String[] labelArrays, String author) {
        this.id = id;
        this.title = title;
        this.type = type;
        this.srcArrays = srcArrays;
        this.power = power;
        this.labelArrays = labelArrays;
        this.author = author;
    }

    /**
     * 用于创建专家类型DTO
     *
     * @param id
     * @param title
     * @param type
     * @param srcArrays
     * @param power
     * @param labelArrays
     * @param number
     * @param titleName
     * @param address
     */
    public SearchIndexDto(String id, String title, String type, String[] srcArrays, Integer power, String[] labelArrays, Integer number, String titleName, String address) {
        this.id = id;
        this.title = title;
        this.type = type;
        this.srcArrays = srcArrays;
        this.power = power;
        this.labelArrays = labelArrays;
        this.number = number;
        this.titleName = titleName;
        this.address = address;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String[] getSrcArrays() {
        return srcArrays;
    }

    public void setSrcArrays(String[] srcArrays) {
        this.srcArrays = srcArrays;
    }

    public Integer getPower() {
        return power;
    }

    public void setPower(Integer power) {
        this.power = power;
    }

    public String[] getLabelArrays() {
        return labelArrays;
    }

    public void setLabelArrays(String[] labelArrays) {
        this.labelArrays = labelArrays;
    }

    public Integer getNumber() {
        return number;
    }

    public void setNumber(Integer number) {
        this.number = number;
    }

    public Integer getTime() {
        return time;
    }

    public void setTime(Integer time) {
        this.time = time;
    }

    public Integer getTopicId() {
        return topicId;
    }

    public void setTopicId(Integer topicId) {
        this.topicId = topicId;
    }

    public Integer getPresentPrice() {
        return presentPrice;
    }

    public void setPresentPrice(Integer presentPrice) {
        this.presentPrice = presentPrice;
    }

    public Integer getOldPrice() {
        return oldPrice;
    }

    public void setOldPrice(Integer oldPrice) {
        this.oldPrice = oldPrice;
    }

    public String getAuthor() {
        return author;
    }

    public void setAuthor(String author) {
        this.author = author;
    }

    public String getTitleName() {
        return titleName;
    }

    public void setTitleName(String titleName) {
        this.titleName = titleName;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    @Override
    public String toString() {
        return "SearchIndexDto{" +
                "id='" + id + '\'' +
                ", title='" + title + '\'' +
                ", content='" + content + '\'' +
                ", type='" + type + '\'' +
                ", srcArrays=" + Arrays.toString(srcArrays) +
                ", power=" + power +
                ", labelArrays=" + Arrays.toString(labelArrays) +
                ", number=" + number +
                ", time=" + time +
                ", topicId=" + topicId +
                ", presentPrice=" + presentPrice +
                ", oldPrice=" + oldPrice +
                ", author='" + author + '\'' +
                ", titleName='" + titleName + '\'' +
                ", address='" + address + '\'' +
                '}';
    }
}
